#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main (int argc, char const* argv[])
{
    int n, b, a, ans;

    while (scanf("%d%d", &b, &n)) {
        if (b == n && n == 0) break;

        a = 0;
        while (pow(a, n) < b) {
            a++;
        }
        a--;

        ans = 
        abs(pow(a, n) - b) < abs(pow(a+1, n) - b) ?
            a : a+1;

        printf("%d\n", ans);
    }

    return 0;
}
